package com.bc.bclocalserviceapihttp.controller;

import com.bc.bcapi.dao.T_CountryMapper;
import com.bc.bcapi.service.ReptilianService;
import com.bc.bcmodel.domain.T_CountryModel;
import com.bc.commoncore.util.FileUtil;
import com.bc.commoncore.util.JsonUtil;
import com.bc.commonentity.common.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Name TestController
 * @Description test
 * @Author douhaichao
 * @Date 2018/9/11 17:37
 * @Version 1.0
 **/
@Api("测试类")
@RequestMapping("test")
@RestController
public class TestController {

    @Resource
    ReptilianService reptilianService;
    @Resource
    T_CountryMapper t_countryMapper;

    @ApiOperation("测试方法")
    @RequestMapping(value = "test", method = RequestMethod.GET)
    public void test() {
        reptilianService.getEtherscan();
    }

    @ApiOperation("采集省市区")
    @RequestMapping(value = "cjprovince", method = RequestMethod.GET)
    public void cjProvince() {
        try {
            byte[] b = FileUtil.getFileByte("C:\\Users\\douhaichao\\Desktop\\list");
            String s = new String(b);
            List<T_CountryModel> list = JsonUtil.str2list(s, T_CountryModel.class);
//            for (T_CountryModel item :
//                    list) {
//                try {
//                    t_countryMapper.insert(item);
//                } catch (Exception ex) {
//                    System.out.println(ex.getMessage());
//                }
//            }
            t_countryMapper.insertBatch(list);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void duizhang(){
//        统计相关
//                买家
//        充值-转冷手续费
//        提交订单-（买家、卖家手续费）
//        提现-（买家、卖家手续费）
//        卖家
//        充值-转冷手续费
//        提交订单（买家、卖家手续费）
//        提现（买家、卖家手续费）
//        管理后台
//        提交订单（买家、卖家手续费）
    }
}
